<template>
  <div class="left-container">
    <h3>Left 组件</h3>
    <p>message的值是: {{ msg }}</p>
    <p>user的值是: {{ user }}</p>
    <!-- <button @click="msg = 'abc'">修改 msg</button>
    <button @click="user.name = 'zs'">修改 user</button> -->
    <hr />

    <button @click="send">把 ‘阿巴阿巴’ 发给Right</button>
  </div>
</template>

<script>
//1.导入 eventBus 模块
import bus from "./eventBus.js";

export default {
  props: ["msg", "user"],
  data() {
    return {
      str: "阿巴阿巴",
    };
  },
  methods: {
    send() {
      //通过eventBus发送数据
      bus.$emit("share", this.str);
    },
  },
};
</script>

<style lang="less">
.left-container {
  padding: 0 20px 20px;
  background-color: orange;
  min-height: 250px;
  flex: 1;
}
</style>
